package com.zc.angelica.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.mapper.LastingLoginMapper;
import com.zc.angelica.entity.LastingLogin;
import com.zc.angelica.service.LastingLoginService;
import org.springframework.stereotype.Service;

/**
 * 持久化登录(LastingLogin)表服务实现类
 *
 * @author makejava
 * @since 2022-04-10 18:34:43
 */
@Service
public class LastingLoginServiceImpl extends ServiceImpl<LastingLoginMapper, LastingLogin> implements LastingLoginService {

    @Override
    public ResponseData addLastingLogin(LastingLogin lastingLogin) {
        boolean save = this.save(lastingLogin);
        if (save) {
            return ResponseData.success("添加成功");
        }
        return ResponseData.error("添加失败");
    }

    @Override
    public ResponseData updateLastingLogin(LastingLogin lastingLogin) {
        boolean update = this.updateById(lastingLogin);
        if (update) {
            return ResponseData.success("更新成功");
        }
        return ResponseData.error("更新失败");
    }

    @Override
    public ResponseData forcedLogout(Long id) {
        boolean remove = this.removeById(id);
        if (remove) {
            return ResponseData.success("注销成功");
        }
        return ResponseData.error("注销失败");
    }
}

